package com.lycafly.fragment;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.lycafly.R;

public class TestFragmentAdapter extends FragmentPagerAdapter {
	public static final String[] CONTENT = new String[] { "This", "Is", "A",
			"Test" };

	private Integer[] mThumbIds = { R.drawable.home_screena,
			R.drawable.home_screenb, R.drawable.home_screenc,
			R.drawable.home_screend, R.drawable.home_screene };

	private int mCount = CONTENT.length;

	public TestFragmentAdapter(FragmentManager fm) {
		super(fm);
	}

	@Override
	public Fragment getItem(int position) {
		return TestFragment.newInstance(CONTENT[position % CONTENT.length],
				mThumbIds[position]);
	}

	@Override
	public int getCount() {
		return mCount;
	}

	@Override
	public CharSequence getPageTitle(int position) {
		return TestFragmentAdapter.CONTENT[position % CONTENT.length];
	}

	public void setCount(int count) {
		if (count > 0 && count <= 10) {
			mCount = count;
			notifyDataSetChanged();
		}
	}
}